from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    #定位元素

    #定位搜索框1
    def kuang1(self):
        #使用ID定位方法
        loc=(By.ID,'cn.xuexi.android:id/text')
        ele=self.find_ele(loc)
        return ele

    #定位搜索框2
    def kuang2(self):
        #使用XPATH定位方法
        loc=(By.XPATH,'//android.widget.EditText[@resource-id="android:id/search_src_text"]')
        ele=self.find_ele(loc)
        return ele

    # 定位搜索框3
    def kuang3(self):
        #使用CLASS_NAME方法
        loc = (By.CLASS_NAME, 'android.widget.EditText')
        ele = self.find_ele(loc)
        return ele

    # 定位搜索框4
    def kuang4(self):
        #使用resource-id定位方式
        loc = (By.RESOURCE_ID, 'android:id/search_src_text')
        ele = self.find_ele(loc)
        return ele

    #定位断言
    def duanyan(self):
        #使用ID定位
        loc=(By.XPATH,'(//android.view.View[@text="视频"])[3]')
        ele=self.find_ele(loc)
        return ele

    #定位搜索按钮
    def anniu(self):
        #使用android uiautomator定位
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().resourceId("android:id/search_mag_icon")')
        ele=self.find_ele(loc)
        return ele



